package Modellus.WinUI.ExampleTable.RibbonTask;

import Modellus.Core.Model.IModel;
import Modellus.WinUI.Animator.Controls.ColorPickerComboBox;
import Modellus.WinUI.Animator.Controls.ISimpleTermPickerListener;
import Modellus.WinUI.Animator.Controls.SimpleTermPicker;
import Modellus.WinUI.Animator.RibbonTask.AnimationObjectConfiguration.SituationPickerComboBox;
import Modellus.WinUI.LocaleInformation;
import Modellus.WinUI.ExampleTable.ITableListener;
import Modellus.WinUI.ExampleTable.TableUI;
import Modellus.WinUI.Utils.UI.JModellusCheckBox;
import Modellus.WinUI.Utils.UI.JModellusLabel;
import Modellus.WinUI.Utils.UI.JModellusNumberTextField;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.NumberFormat;
import java.util.ResourceBundle;
import java.util.Vector;

public class TableValuesComponent implements ITableListener {
    private JPanel _topPanel;
    private JModellusNumberTextField _steps;
    private JCheckBox _showDataBars;
    private SimpleTermPicker _variable0;
    private SimpleTermPicker _variable1;
    private SimpleTermPicker _variable2;
    private SimpleTermPicker _variable3;
    private SimpleTermPicker _variable4;
    private SimpleTermPicker _variable5;
    private SimpleTermPicker _variable6;
    private SimpleTermPicker _variable7;
    private SimpleTermPicker _variable8;
    private SimpleTermPicker _variable9;
    private SituationPickerComboBox _variableSituation1;
    private SituationPickerComboBox _variableSituation2;
    private SituationPickerComboBox _variableSituation3;
    private SituationPickerComboBox _variableSituation4;
    private SituationPickerComboBox _variableSituation5;
    private SituationPickerComboBox _variableSituation6;
    private SituationPickerComboBox _variableSituation7;
    private SituationPickerComboBox _variableSituation8;
    private SituationPickerComboBox _variableSituation9;
    private SituationPickerComboBox _variableSituation0;
    private ColorPickerComboBox _variableColor0;
    private ColorPickerComboBox _variableColor1;
    private ColorPickerComboBox _variableColor2;
    private ColorPickerComboBox _variableColor3;
    private ColorPickerComboBox _variableColor4;
    private ColorPickerComboBox _variableColor5;
    private ColorPickerComboBox _variableColor6;
    private ColorPickerComboBox _variableColor7;
    private ColorPickerComboBox _variableColor8;
    private ColorPickerComboBox _variableColor9;
    private JPanel _stepPanel;
    private JModellusLabel _StroboscopyLeftLabel;
    private JModellusLabel _StroboscopyRightLabel;
    private Vector<SimpleTermPicker> _variables = new Vector<SimpleTermPicker>();
    private Vector<SituationPickerComboBox> _situations = new Vector<SituationPickerComboBox>();
    private Vector<ColorPickerComboBox> _colors = new Vector<ColorPickerComboBox>();
    TableUI _tableUI;
    private IModel _model;

    static ResourceBundle TableResourceBundle = LocaleInformation.instance().getBundle("Modellus/WinUI/tableTask");

    public TableValuesComponent()
    {
        $$$setupUI$$$();
        _stepPanel.setOpaque(false);
        _topPanel.setOpaque(false);
        updateAndLocalizeLabels();
    }

    private void updateAndLocalizeLabels()
    {
        _StroboscopyLeftLabel.setText(TableResourceBundle.getString("Stroboscopy_Left_Label"));
        _StroboscopyRightLabel.setText(TableResourceBundle.getString("Stroboscopy_Right_Label"));
        _showDataBars.setText(TableResourceBundle.getString("Enable_Data_Bars"));
    }

    public void init(TableUI tableUI, IModel model)
    {
        _model = model;
        _tableUI = tableUI;
        _tableUI.addListener(this);
        _variables.add(_variable0);
        _variables.add(_variable1);
        _variables.add(_variable2);
        _variables.add(_variable3);
        _variables.add(_variable4);
        _variables.add(_variable5);
        _variables.add(_variable6);
        _variables.add(_variable7);
        _variables.add(_variable8);
        _variables.add(_variable9);
        _situations.add(_variableSituation0);
        _situations.add(_variableSituation1);
        _situations.add(_variableSituation2);
        _situations.add(_variableSituation3);
        _situations.add(_variableSituation4);
        _situations.add(_variableSituation5);
        _situations.add(_variableSituation6);
        _situations.add(_variableSituation7);
        _situations.add(_variableSituation8);
        _situations.add(_variableSituation9);
        _colors.add(_variableColor0);
        _colors.add(_variableColor1);
        _colors.add(_variableColor2);
        _colors.add(_variableColor3);
        _colors.add(_variableColor4);
        _colors.add(_variableColor5);
        _colors.add(_variableColor6);
        _colors.add(_variableColor7);
        _colors.add(_variableColor8);
        _colors.add(_variableColor9);
        setupVariables(_variables);
        setupSituations(_situations);
        setupColors(_colors);
        setupSteps();
        setupBars();
    }

    public JComponent getJComponent()
    {
        return _topPanel;
    }

    private void setupSteps()
    {
        _steps.setValue(_tableUI.getSteps());

        _steps.addPropertyChangeListener("value", new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent evt)
            {
                _tableUI.setSteps(((Number) _steps.getValue()).intValue());
            }
        });
    }

    private void setupBars()
    {
        _showDataBars.setSelected(_tableUI.getShowBars());
        _tableUI.addListener(new ITableListener() {
            public void showBarsChanged()
            {
                _showDataBars.setSelected(_tableUI.getShowBars());
            }

            public void variablesChanged()
            {
            }

            public void stepsChanged()
            {
            }
        });
        _showDataBars.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e)
            {
                _tableUI.setShowBars(_showDataBars.isSelected());
            }
        });
    }

    private void setupVariables(Vector<SimpleTermPicker> variables)
    {
        for (int variableIndex = 0; variableIndex < variables.size(); variableIndex++)
        {
            final SimpleTermPicker variable = variables.get(variableIndex);
            final int index = variableIndex;

            variable.init(_model, _tableUI.getVariable(index));
            variable.addTermPickerListener(new ISimpleTermPickerListener() {
                public void propertyChanged(SimpleTermPicker source)
                {
                    _tableUI.setVariable(index);
                }
            });

        }
    }

    private void setupSituations(Vector<SituationPickerComboBox> situations)
    {
        for (int situationIndex = 0; situationIndex < situations.size(); situationIndex++)
        {
            final SituationPickerComboBox situation = situations.get(situationIndex);
            final int index = situationIndex;
            situation.setSelectedSituation(_tableUI.getVariableSituation(index));
            situation.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e)
                {
                    _tableUI.setVariableSituation(index, situation.getSelectedIndex());
                }
            });
        }
    }

    private void setupColors(Vector<ColorPickerComboBox> colors)
    {
        for (int colorIndex = 0; colorIndex < colors.size(); colorIndex++)
        {
            final ColorPickerComboBox colorPicker = colors.get(colorIndex);
            final int index = colorIndex;
            colorPicker.setSelectedColor(_tableUI.getVariableColor(index));
            colorPicker.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e)
                {
                    _tableUI.setVariableColor(index, colorPicker.getSelectedColor());
                }
            });
        }
    }

    public void showBarsChanged()
    {
        _showDataBars.setSelected(_tableUI.getShowBars());
    }

    public void variablesChanged()
    {
        for (int variableIndex = 0; variableIndex < _variables.size(); variableIndex++)
        {
            SimpleTermPicker variable = _variables.get(variableIndex);
            try
            {
                variable.setProperty(_tableUI.getVariable(variableIndex));
                SituationPickerComboBox situation = _situations.get(variableIndex);
                situation.setSelectedIndex(_tableUI.getVariableSituation(variableIndex));
                ColorPickerComboBox colorPicker = _colors.get(variableIndex);
                colorPicker.setSelectedColor(_tableUI.getVariableColor(variableIndex));
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }

    public void stepsChanged()
    {
        _steps.setText(String.valueOf(_tableUI.getSteps()));
    }

    private void createUIComponents()
    {
        _steps = new JModellusNumberTextField(NumberFormat.getIntegerInstance());

    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$()
    {
        createUIComponents();
        _topPanel = new JPanel();
        _topPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(2, 2, new Insets(0, 4, 0, 4), 1, 1));
        _stepPanel = new JPanel();
        _stepPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
        _topPanel.add(_stepPanel, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _StroboscopyRightLabel = new JModellusLabel();
        this.$$$loadLabelText$$$(_StroboscopyRightLabel, ResourceBundle.getBundle("Modellus/WinUI/tableTask").getString("Stroboscopy_Right_Label"));
        _stepPanel.add(_StroboscopyRightLabel, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _StroboscopyLeftLabel = new JModellusLabel();
        this.$$$loadLabelText$$$(_StroboscopyLeftLabel, ResourceBundle.getBundle("Modellus/WinUI/tableTask").getString("Stroboscopy_Left_Label"));
        _stepPanel.add(_StroboscopyLeftLabel, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _steps.setHorizontalAlignment(4);
        _steps.setText("1.00");
        _stepPanel.add(_steps, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(25, -1), null, null, 0, false));
        _showDataBars = new JModellusCheckBox();
        this.$$$loadButtonText$$$(_showDataBars, ResourceBundle.getBundle("Modellus/WinUI/tableTask").getString("Enable_Data_Bars"));
        _topPanel.add(_showDataBars, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        final JPanel panel1 = new JPanel();
        panel1.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 10, new Insets(0, 0, 0, 0), 4, -1));
        _topPanel.add(panel1, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 2, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor0 = new ColorPickerComboBox();
        panel1.add(_variableColor0, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor1 = new ColorPickerComboBox();
        panel1.add(_variableColor1, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor2 = new ColorPickerComboBox();
        panel1.add(_variableColor2, new com.intellij.uiDesigner.core.GridConstraints(1, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor3 = new ColorPickerComboBox();
        panel1.add(_variableColor3, new com.intellij.uiDesigner.core.GridConstraints(1, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor4 = new ColorPickerComboBox();
        panel1.add(_variableColor4, new com.intellij.uiDesigner.core.GridConstraints(1, 4, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor5 = new ColorPickerComboBox();
        panel1.add(_variableColor5, new com.intellij.uiDesigner.core.GridConstraints(1, 5, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor6 = new ColorPickerComboBox();
        panel1.add(_variableColor6, new com.intellij.uiDesigner.core.GridConstraints(1, 6, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor7 = new ColorPickerComboBox();
        panel1.add(_variableColor7, new com.intellij.uiDesigner.core.GridConstraints(1, 7, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor8 = new ColorPickerComboBox();
        _variableColor8.setVisible(false);
        panel1.add(_variableColor8, new com.intellij.uiDesigner.core.GridConstraints(1, 8, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableColor9 = new ColorPickerComboBox();
        _variableColor9.setVisible(false);
        panel1.add(_variableColor9, new com.intellij.uiDesigner.core.GridConstraints(1, 9, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable0 = new SimpleTermPicker();
        panel1.add(_variable0, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable1 = new SimpleTermPicker();
        panel1.add(_variable1, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable2 = new SimpleTermPicker();
        panel1.add(_variable2, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable3 = new SimpleTermPicker();
        panel1.add(_variable3, new com.intellij.uiDesigner.core.GridConstraints(0, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable4 = new SimpleTermPicker();
        panel1.add(_variable4, new com.intellij.uiDesigner.core.GridConstraints(0, 4, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable5 = new SimpleTermPicker();
        panel1.add(_variable5, new com.intellij.uiDesigner.core.GridConstraints(0, 5, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable6 = new SimpleTermPicker();
        panel1.add(_variable6, new com.intellij.uiDesigner.core.GridConstraints(0, 6, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable7 = new SimpleTermPicker();
        panel1.add(_variable7, new com.intellij.uiDesigner.core.GridConstraints(0, 7, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable8 = new SimpleTermPicker();
        _variable8.setVisible(false);
        panel1.add(_variable8, new com.intellij.uiDesigner.core.GridConstraints(0, 8, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variable9 = new SimpleTermPicker();
        _variable9.setVisible(false);
        panel1.add(_variable9, new com.intellij.uiDesigner.core.GridConstraints(0, 9, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation0 = new SituationPickerComboBox();
        panel1.add(_variableSituation0, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation1 = new SituationPickerComboBox();
        panel1.add(_variableSituation1, new com.intellij.uiDesigner.core.GridConstraints(2, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation2 = new SituationPickerComboBox();
        panel1.add(_variableSituation2, new com.intellij.uiDesigner.core.GridConstraints(2, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation3 = new SituationPickerComboBox();
        panel1.add(_variableSituation3, new com.intellij.uiDesigner.core.GridConstraints(2, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation4 = new SituationPickerComboBox();
        panel1.add(_variableSituation4, new com.intellij.uiDesigner.core.GridConstraints(2, 4, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation5 = new SituationPickerComboBox();
        panel1.add(_variableSituation5, new com.intellij.uiDesigner.core.GridConstraints(2, 5, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation6 = new SituationPickerComboBox();
        panel1.add(_variableSituation6, new com.intellij.uiDesigner.core.GridConstraints(2, 6, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation7 = new SituationPickerComboBox();
        panel1.add(_variableSituation7, new com.intellij.uiDesigner.core.GridConstraints(2, 7, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation8 = new SituationPickerComboBox();
        _variableSituation8.setVisible(false);
        panel1.add(_variableSituation8, new com.intellij.uiDesigner.core.GridConstraints(2, 8, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        _variableSituation9 = new SituationPickerComboBox();
        _variableSituation9.setVisible(false);
        panel1.add(_variableSituation9, new com.intellij.uiDesigner.core.GridConstraints(2, 9, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    }

    /**
     * @noinspection ALL
     */
    private void $$$loadLabelText$$$(JLabel component, String text)
    {
        StringBuffer result = new StringBuffer();
        boolean haveMnemonic = false;
        char mnemonic = '\0';
        int mnemonicIndex = -1;
        for (int i = 0; i < text.length(); i++)
        {
            if (text.charAt(i) == '&')
            {
                i++;
                if (i == text.length()) break;
                if (!haveMnemonic && text.charAt(i) != '&')
                {
                    haveMnemonic = true;
                    mnemonic = text.charAt(i);
                    mnemonicIndex = result.length();
                }
            }
            result.append(text.charAt(i));
        }
        component.setText(result.toString());
        if (haveMnemonic)
        {
            component.setDisplayedMnemonic(mnemonic);
            component.setDisplayedMnemonicIndex(mnemonicIndex);
        }
    }

    /**
     * @noinspection ALL
     */
    private void $$$loadButtonText$$$(AbstractButton component, String text)
    {
        StringBuffer result = new StringBuffer();
        boolean haveMnemonic = false;
        char mnemonic = '\0';
        int mnemonicIndex = -1;
        for (int i = 0; i < text.length(); i++)
        {
            if (text.charAt(i) == '&')
            {
                i++;
                if (i == text.length()) break;
                if (!haveMnemonic && text.charAt(i) != '&')
                {
                    haveMnemonic = true;
                    mnemonic = text.charAt(i);
                    mnemonicIndex = result.length();
                }
            }
            result.append(text.charAt(i));
        }
        component.setText(result.toString());
        if (haveMnemonic)
        {
            component.setMnemonic(mnemonic);
            component.setDisplayedMnemonicIndex(mnemonicIndex);
        }
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$()
    {
        return _topPanel;
    }
}
